<?xml version="1.0" encoding="utf-8" ?>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Insert title here</title>
</head>
<body>


<!-- JstlObjects.jsp
     Copyright (c) 2003 by Dr. Herong Yang
-->
<p>Browsing all the JSTL implicit objects:</p>
<p>"pageContext":</p>
<c:out value="${pageContext}"/><br/>


<p>"pageScope":</p>
<c:forEach items="${pageScope}" var="entry">
 <c:out value="${entry}"/><br/>
</c:forEach>

<p>"requestScope":</p>
<c:forEach items="${requestScope}" var="entry">
 <c:out value="${entry}"/><br/>
</c:forEach>

<p>"sessionScope":</p>
<c:forEach items="${sessionScope}" var="entry">
 <c:out value="${entry}"/><br/>
</c:forEach>

<p>"applicationScope":</p>
<c:forEach items="${applicationScope}" var="entry">
 <c:out value="${entry}"/><br/>
</c:forEach>

<p>"param":</p>
<c:forEach items="${param}" var="entry">
 <c:out value="${entry}"/><br/>
</c:forEach>

<p>"paramValues":</p>
<c:forEach items="${paramValues}" var="entry">
 <c:out value="${entry}"/><br/>
</c:forEach>

<p>"header":</p>
<c:forEach items="${header}" var="entry">
 <c:out value="${entry}"/><br/>
</c:forEach>

<p>"headerValues":</p>
<c:forEach items="${headerValues}" var="entry">
 <c:out value="${entry}"/><br/>
</c:forEach>

<p>"cookie":</p>
<c:forEach items="${cookie}" var="entry">
 <c:out value="${entry}"/><br/>
</c:forEach>

<p>"initParam":</p>
<c:forEach items="${initParam}" var="entry">
 <c:out value="${entry}"/><br/>
</c:forEach>

<p>Class path list:</p>
<c:forTokens
 items="${applicationScope['org.apache.catalina.jsp_classpath']}"
 delims=";" var="entry">
 <c:out value="${entry}"/><br/>
</c:forTokens>

<hr/>

<p>Checking prime numbers:</p>
<c:set var="upperLimit" value="${20}"/>
<c:forEach var="i" begin="${3}" end="${upperLimit}">
 <c:set var="isPrime" value="${true}"/>
 <c:forEach var="j" begin="${2}" end="${i-1}">
  <c:if test="${i%j == 0}">
   <c:set var="isPrime" value="${false}"/>
   <!-- We should break the loop here -->
  </c:if>
 </c:forEach>
 <c:choose>
  <c:when test="${isPrime}">
   <c:out value="${i} is a prime number."/><br/>
  </c:when>
  <c:otherwise>
   <c:out value="${i} is a not prime number."/><br/>
  </c:otherwise>
 </c:choose>
</c:forEach>

</body>
</html>